/**
 * Tencent is pleased to support the open source community by making Tars available.
 *
 * Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
 *
 * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * https://opensource.org/licenses/BSD-3-Clause
 *
 * Unless required by applicable law or agreed to in writing, software distributed
 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 */
// **********************************************************************
// This file was generated by a TARS parser!
// TARS version 1.0.1.
// **********************************************************************

package com.qq.tars.support.property.prx;

import com.qq.tars.protocol.util.*;
import com.qq.tars.protocol.annotation.*;
import com.qq.tars.protocol.tars.*;
import com.qq.tars.protocol.tars.annotation.*;

@TarsStruct
public class StatPropMsgHead implements Comparable<StatPropMsgHead> {

	@TarsStructProperty(order = 0, isRequire = true)
	public String moduleName = "";
	@TarsStructProperty(order = 1, isRequire = true)
	public String ip = "";
	@TarsStructProperty(order = 2, isRequire = true)
	public String propertyName = "";
	@TarsStructProperty(order = 3, isRequire = false)
	public String setName = "";
	@TarsStructProperty(order = 4, isRequire = false)
	public String setArea = "";
	@TarsStructProperty(order = 5, isRequire = false)
	public String setID = "";
	@TarsStructProperty(order = 6, isRequire = false)
	public String sContainer = "";
	@TarsStructProperty(order = 7, isRequire = false)
	public int iPropertyVer = 1;

	public String getModuleName() {
		return moduleName;
	}

	public void setModuleName(String moduleName) {
		this.moduleName = moduleName;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public String getPropertyName() {
		return propertyName;
	}

	public void setPropertyName(String propertyName) {
		this.propertyName = propertyName;
	}

	public String getSetName() {
		return setName;
	}

	public void setSetName(String setName) {
		this.setName = setName;
	}

	public String getSetArea() {
		return setArea;
	}

	public void setSetArea(String setArea) {
		this.setArea = setArea;
	}

	public String getSetID() {
		return setID;
	}

	public void setSetID(String setID) {
		this.setID = setID;
	}

	public String getSContainer() {
		return sContainer;
	}

	public void setSContainer(String sContainer) {
		this.sContainer = sContainer;
	}

	public int getIPropertyVer() {
		return iPropertyVer;
	}

	public void setIPropertyVer(int iPropertyVer) {
		this.iPropertyVer = iPropertyVer;
	}

	public StatPropMsgHead() {
	}

	public StatPropMsgHead(String moduleName, String ip, String propertyName, String setName, String setArea, String setID, String sContainer, int iPropertyVer) {
		this.moduleName = moduleName;
		this.ip = ip;
		this.propertyName = propertyName;
		this.setName = setName;
		this.setArea = setArea;
		this.setID = setID;
		this.sContainer = sContainer;
		this.iPropertyVer = iPropertyVer;
	}

	@Override
	public int compareTo(StatPropMsgHead o) {
		int c = 0;
		if((c = TarsUtil.compareTo(moduleName, o.moduleName)) != 0 ) {
			return c;
		}
		if((c = TarsUtil.compareTo(ip, o.ip)) != 0 ) {
			return c;
		}
		if((c = TarsUtil.compareTo(propertyName, o.propertyName)) != 0 ) {
			return c;
		}
		if((c = TarsUtil.compareTo(setName, o.setName)) != 0 ) {
			return c;
		}
		if((c = TarsUtil.compareTo(setArea, o.setArea)) != 0 ) {
			return c;
		}
		if((c = TarsUtil.compareTo(setID, o.setID)) != 0 ) {
			return c;
		}
		return 0;
	}


	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + TarsUtil.hashCode(moduleName);
		result = prime * result + TarsUtil.hashCode(ip);
		result = prime * result + TarsUtil.hashCode(propertyName);
		result = prime * result + TarsUtil.hashCode(setName);
		result = prime * result + TarsUtil.hashCode(setArea);
		result = prime * result + TarsUtil.hashCode(setID);
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (!(obj instanceof StatPropMsgHead)) {
			return false;
		}
		StatPropMsgHead other = (StatPropMsgHead) obj;
		return (
			TarsUtil.equals(moduleName, other.moduleName) &&
			TarsUtil.equals(ip, other.ip) &&
			TarsUtil.equals(propertyName, other.propertyName) &&
			TarsUtil.equals(setName, other.setName) &&
			TarsUtil.equals(setArea, other.setArea) &&
			TarsUtil.equals(setID, other.setID) 
		);
	}

	public void writeTo(TarsOutputStream _os) {
		if (null != moduleName) {
			_os.write(moduleName, 0);
		}
		if (null != ip) {
			_os.write(ip, 1);
		}
		if (null != propertyName) {
			_os.write(propertyName, 2);
		}
		if (null != setName) {
			_os.write(setName, 3);
		}
		if (null != setArea) {
			_os.write(setArea, 4);
		}
		if (null != setID) {
			_os.write(setID, 5);
		}
		if (null != sContainer) {
			_os.write(sContainer, 6);
		}
		_os.write(iPropertyVer, 7);
	}

	public void readFrom(TarsInputStream _is) {
		this.moduleName = _is.read(moduleName, 0, true);
		this.ip = _is.read(ip, 1, true);
		this.propertyName = _is.read(propertyName, 2, true);
		this.setName = _is.read(setName, 3, false);
		this.setArea = _is.read(setArea, 4, false);
		this.setID = _is.read(setID, 5, false);
		this.sContainer = _is.read(sContainer, 6, false);
		this.iPropertyVer = _is.read(iPropertyVer, 7, false);
	}

}
